package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.QuestionReplyAddDto;
import com.tianji.learning.domain.query.QuestionReplyPageQuery;
import com.tianji.learning.domain.vo.QuestionReplyVo;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author hc
 * @since 2024-08-25
 */
@Api(tags = "用户端互动回答和评论相关接口")
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
public class InteractionReplyController {

    private final  IInteractionReplyService replyService;

    @GetMapping("/page")
    @ApiOperation("分页查询【回答】或【评论】列表")
    public PageDTO<QuestionReplyVo> queryPageReply(QuestionReplyPageQuery pageQuery) {
        return replyService.queryPageReply(pageQuery);
    }

    /**
     * <h1>新增回答或评论</h1>
     * @param replyAddDto
     */
    @PostMapping
    @ApiOperation("新增回答或评论")
    public void  saveReply(  @RequestBody QuestionReplyAddDto replyAddDto){
        replyService.saveReply(replyAddDto);
    }

}
